/*
 *  Copyright 2009 Lucas Nazário dos Santos
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package net.sourceforge.retriever.frontier;

import java.util.Map;

/**
 * TODO Write javadoc.
 */
public class FrontierUrl {


	private String url;

	private String ip;

	private FrontierUrl parent;

	private Map<String, Object> additionalInfo;

	private long timeToSleepInMillis = 0;

	private Throwable exceptionFetching;

	/**
	 * TODO Write javadoc.
	 */
	public String getUrl() {
		return this.url;
	}

	/**
	 * TODO Write javadoc.
	 */
	public void setUrl(final String url) {
		this.url = url;
	}

	/**
	 * TODO Write javadoc.
	 */
	public String getIp() {
		return this.ip;
	}

	/**
	 * TODO Write javadoc.
	 */
	public void setIp(final String ip) {
		this.ip = ip;
	}

	/**
	 * TODO Write javadoc.
	 */
	public FrontierUrl getParent() {
		return this.parent;
	}

	/**
	 * TODO Write javadoc.
	 */
	public void setParent(final FrontierUrl parent) {
		this.parent = parent;
	}

	/**
	 * TODO Write javadoc.
	 */
	public Map<String, Object> getAdditionalInfo() {
		return this.additionalInfo;
	}

	/**
	 * TODO Write javadoc.
	 */
	public void setAdditionalInfo(final Map<String, Object> additionalInfo) {
		this.additionalInfo = additionalInfo;
	}

	/**
	 * TODO Write javadoc.
	 */
	public void setTimeToSleepInMillis(final long time) {
		this.timeToSleepInMillis = time;
	}

	/**
	 * TODO Write javadoc.
	 */
	public long getTimeToSleepInMillis() {
		return this.timeToSleepInMillis;
	}

	public Throwable getExceptionFetching() {
		return this.exceptionFetching;
	}

	public void setExceptionFetching(final Throwable exceptionFetching) {
		this.exceptionFetching = exceptionFetching;
	}

	/**
	 * TODO Javadoc.
	 */
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		return result;
	}

	/**
	 * TODO Javadoc.
	 */
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FrontierUrl other = (FrontierUrl) obj;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		return true;
	}
}